package cn.maszy.common;

import java.io.UnsupportedEncodingException;

import javax.servlet.http.HttpServletRequest;

public class Transcoding {
	public static String getcode(HttpServletRequest request,String flag) throws UnsupportedEncodingException
	{
		if (request.getHeader("User-Agent").toUpperCase()  
                .indexOf("MSIE") > 0) {  
//			if(request.getHeader("User-Agent").toUpperCase()  
//	                .indexOf("QQDOWNLOAD") > 0)
//			{
//				flag =new String(flag.getBytes("ISO8859_1"),"UTF-8"); //360IE
//			}
//			else{
				flag =new String(flag.getBytes("ISO8859_1"),"GBK"); //IE
//			}
        }else if (request.getHeader("User-Agent").toUpperCase()  
                .indexOf("CHROME") > 0) {  
        	flag =new String(flag.getBytes("ISO8859_1"),"UTF-8");// 谷歌  
        } 
		
		return flag;
	}
}
